﻿import QtQuick 2.11

import "."
import "_Global"
import "_Global/Popup"
import "_Global/Button"

import "_Global/Global.js" as GlobalJS
import "GameJS.js" as GameJS

Popup {
    //property string playerAccount

    signal continueGame()
    signal terminateGame(int code)
    signal restartGame()



    id: root
    width: 600
    height: 400
    color: "#00000000"



    animationType: "fade"; //出现动画类型
    duration: 200;        //动画时间
    easingType: Easing.Linear; //动画效果

    showMask: true
    //maskParent: root
    maskColor: 'black'
    maskOpacity: 0.5



    Image {
        id: back
        source: Global._FixResourcePath_R("Media/Images/Class/ClassInfo/Back.png")
        anchors.fill: parent
    }

    Text {
        id: textMsg
        x: Global.gamePos.mapGameEscMenu.rectMsg.x
        y: Global.gamePos.mapGameEscMenu.rectMsg.y
        width: Global.gamePos.mapGameEscMenu.rectMsg.width
        height: Global.gamePos.mapGameEscMenu.rectMsg.height
        font.pixelSize: Global.gamePos.mapGameEscMenu.nMsgFontSize
        color: "white"
        //style: Text.Outline;
        //styleColor: "black"
        //horizontalAlignment: Text.AlignHCenter
        //verticalAlignment: Text.AlignVCenter
        //horizontalAlignment: Text.AlignLeft
        text: "强制退出学习扣100积分，是否继续退出？"
        wrapMode: Text.Wrap
        //lineHeight: 1.3

    }

    ImageButton2 {  //继续
        id: buttonContinue
        source: Global._FixResourcePath_R("Media/Images/Game/GameOver/Continue.png")
        x: Global.gamePos.mapGameEscMenu.rectContinueButton.x
        y: Global.gamePos.mapGameEscMenu.rectContinueButton.y
        width: Global.gamePos.mapGameEscMenu.rectContinueButton.width
        height: Global.gamePos.mapGameEscMenu.rectContinueButton.height

        soundEffectClick: Global.resource.effects.effectButton
        bEffectOn: Global.config.bEffectOn

        onButtonClicked: {
            root.hide()
        }
    }

    ImageButton2 {  //关闭
        id: buttonExit
        source: Global._FixResourcePath_R("Media/Images/Game/GameOver/Exit.png")
        x: Global.gamePos.mapGameEscMenu.rectExitButton.x
        y: Global.gamePos.mapGameEscMenu.rectExitButton.y
        width: Global.gamePos.mapGameEscMenu.rectExitButton.width
        height: Global.gamePos.mapGameEscMenu.rectExitButton.height

        soundEffectClick: Global.resource.effects.effectButton
        bEffectOn: Global.config.bEffectOn

        onButtonClicked: {
            root.hide();
            terminateGame(-1);
        }
    }

    /*
    ColorButton {
        anchors.horizontalCenter: root.horizontalCenter
        anchors.verticalCenter: root.verticalCenter
        anchors.horizontalCenterOffset: 0
        anchors.verticalCenterOffset: -100
        Text {
            font.pixelSize: 24;
            text: qsTr("继续游戏")
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }
        onButtonClicked: {
            root.hide()
            //continueGame()
        }
    }

    ColorButton {
        anchors.horizontalCenter: root.horizontalCenter
        anchors.verticalCenter: root.verticalCenter
        anchors.horizontalCenterOffset: 0
        anchors.verticalCenterOffset: 0
        Text {
            font.pixelSize: 24;
            id: buttonRestart
            text: qsTr("重新开始")
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }
        onButtonClicked: {
            root.hide()
            restartGame()
        }
    }

    ColorButton {
        anchors.horizontalCenter: root.horizontalCenter
        anchors.verticalCenter: root.verticalCenter
        anchors.horizontalCenterOffset: 0
        anchors.verticalCenterOffset: 100
        Text {
            font.pixelSize: 24;
            id: buttonChoice
            text: qsTr("强制结束游戏")
            anchors.fill: parent
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }
        onButtonClicked: {
            root.hide();
            terminateGame(-1);
        }
    }
*/
    Component.onCompleted: {
    }
}
